Technical Q&As


QTW 23 - Using Action Filters, More About Action Filters (1-May-95)




The following example shows how to write an action filter that is triggered every time a movie stops at the end of the movie duration:

Boolean CALLBACK __export MovieStopped (MovieController mc,
                                        UINT            uAction,
                                        LPVOID          lpParam,
                                        LONG            lRefCon)
   {
   TimeRecord tr;
   TimeValue  tv;

   switch (uAction)
      {
      case mcActionPlay:
         if (lpParam == 0)   // Did the movie stop?
            {
            tv = GetMovieTime (mMovie, &tr);
            // Note we stored the movie duration to a global when
            // we opened the movie.
            if (tv == gMovieDuration) // At the end of the movie?
                MessageBox (NULL, "Movie Stopped at the End", "", NULL);
            }
         return FALSE;  // Let the movie toolbox handle the mcActionPlay as well.

        default:
           return FALSE;
        }
   }

Note the lpParam parameter contains the rate value called when the mcDoAction is called with the rate of 0. If you try to get the rate inside the filter proc using mcActionGetPlayRate, you get the next possible play rate change, not the current one called. In other words, if you want to check out the value used when the filter proc is triggered, use lpParam.

Technical Q&As
Previous Question | Contents | Next Question